package com.ruoyi.web.controller.system;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.AboutYct;
import com.ruoyi.system.service.IAboutYctService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 关于缘赐堂Controller
 * 
 * @author ruoyi
 * @date 2021-03-03
 */
@Api(value = "关于缘赐堂后管",tags = "关于缘赐堂后管",description = "关于缘赐堂后管")
@Controller
@RequestMapping("/yct/about_yct")
public class AboutYctController extends BaseController
{
    private String prefix = "yct/about_yct";

    @Autowired
    private IAboutYctService aboutYctService;

    @RequiresPermissions("yct:about_yct:view")
    @GetMapping()
    public String about_yct()
    {
        return prefix + "/about_yct";
    }

    /**
     * 查询关于缘赐堂列表
     */
    @ApiOperation(value = "查询关于缘赐堂列表",notes = "查询关于缘赐堂列表")
    @RequiresPermissions("yct:about_yct:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(AboutYct aboutYct)
    {
        startPage();
        List<AboutYct> list = aboutYctService.selectAboutYctList(aboutYct);
        return getDataTable(list);
    }

    /**
     * 导出关于缘赐堂列表
     */
    @ApiOperation(value = "导出关于缘赐堂列表",notes = "导出关于缘赐堂列表")
    @RequiresPermissions("yct:about_yct:export")
    @Log(title = "关于缘赐堂", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(AboutYct aboutYct)
    {
        List<AboutYct> list = aboutYctService.selectAboutYctList(aboutYct);
        ExcelUtil<AboutYct> util = new ExcelUtil<AboutYct>(AboutYct.class);
        return util.exportExcel(list, "about_yct");
    }

    /**
     * 新增关于缘赐堂
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存关于缘赐堂
     */
    @ApiOperation(value = "新增保存关于缘赐堂",notes = "新增保存关于缘赐堂")
    @RequiresPermissions("yct:about_yct:add")
    @Log(title = "关于缘赐堂", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(AboutYct aboutYct)
    {
        return toAjax(aboutYctService.insertAboutYct(aboutYct));
    }

    /**
     * 修改关于缘赐堂
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        AboutYct aboutYct = aboutYctService.selectAboutYctById(id);
        mmap.put("aboutYct", aboutYct);
        return prefix + "/edit";
    }

    /**
     * 修改保存关于缘赐堂
     */
    @ApiOperation(value = "修改关于缘赐堂",notes = "修改关于缘赐堂")
    @RequiresPermissions("yct:about_yct:edit")
    @Log(title = "关于缘赐堂", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(AboutYct aboutYct)
    {
        return toAjax(aboutYctService.updateAboutYct(aboutYct));
    }

    /**
     * 删除关于缘赐堂
     */
    @ApiOperation(value = "删除关于缘赐堂",notes = "删除关于缘赐堂")
    @RequiresPermissions("yct:about_yct:remove")
    @Log(title = "关于缘赐堂", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(aboutYctService.deleteAboutYctByIds(ids));
    }
}
